Description
Server-side and client-side events can be used to configure the Google Map Component when it is displayed.
Discussion
When the Google Map component is run initially, server and client-side events fire in the following order: onComponentInitialize -> onComponentExecute -> onInitialRender
When an Ajax callback is made, events fire in the following order: canAjaxCallback -> onComponentExecute -> afterAjaxCallbackComplete
Server-side Events
Like all user-defined components, the Google Map Component exposes several user-modifiable server-side events: onComponentInitialize, onComponentExecute, and onInitialRender, called in that order when the component is first run. When an ajax callback is made, the onComponentExecute event is called.
The Google Map Component does all of its server-side initialization in the systemOnInitialRender event, which is called just prior to onInitialRender. The markerPropertyArray or markerPropertyArrayString inside the onComponentInitialize event can be used to populate the map with marker data that has been retrieved from a database, web service, or calculated using Xbasic. If markerPropertyArrayString has been defined when systemOnInitialRender is run, it is used to populate the JavaScript bulkMarkersArray. If markerPropertyArrayString has not been defined, markerPropertyArray is used to populate the JavaScript bulkMarkersArray instead (if markerPropertyArray contains data.)
onInitialRender Event
This function is called to render the component. It generates the HTML and JavaScript for the Google Map component. It must set the following properties:
- Property
- Description
- e.javascript
JavaScript to execute in the client's browser. Be careful not to overwrite the JavaScript already defined in the e.javascript variable. e.javascript contains pre-calculated JavaScript for the Google Map component. You can append additional JavaScript to e.javascript as follows: e.javascript = e.javascript + myJS.
- e.html
The HTML to render. Be careful not to overwrite the HTML already defined in e.html. e.html contains pre-calculated HTML for the Google Map component. You can add additional HTML to the e.html variable as follows: e.html = htmlBefore + e.html + htmlAfter.
Do not overwrite e.javascript in the onInitialRender event, or no map will be displayed. You may append your own JavaScript if you wish, e.g. e.javascript = e.javascript + myJS
Similarly, do not overwrite e.html, or the DIV that holds the map will not be created. If you wish to modify the DIV or toolbar HTML, edit the exposed HTML properties.
onComponentInitialize Event
Fires the first time the Google Map component is run.
onComponentExecute Event
Fires every time the Google Map component is run.
Client-side Events
Like all custom and user-defined components, the Google Map Component exposes the following user-modifiable client-side events:
canAjaxCallback Event
Fires before an Ajax callback. If the function returns false, the callback will be aborted.
Parameters
JavaScript in the canAjaxCallback event can reference the following parameters:
- e.xbasicFunctionName
The name of the Xbasic function that will be called.
- e.ajaxEvent
The Xbasic event that will be called.
afterAjaxCallbackComplete Event
Fire after an Ajax callback has completed.
Parameters
JavaScript in the afterAjaxCallbackComplete event can reference the following parameters:
- e.xbasicFunctionName
The name of the Xbasic function that was executed in the callback.
- e.ajaxEvent
The Xbasic event that was executed in the callback.
onInitializeComplete Event
Fires after the Google Map component is completely initialized and all HTML has been rendered. It fires once when the Google Map component is first rendered. onInitializeComplete not fire on subsequent Ajax callbacks.
onInitializeComplete does not have any parameters.
onEventsLoad Event
Fires when events are loaded.
onEventsLoad does not have any parameters.
onRenderComplete Event
The last event to fire when the Google Map component is rendered.
onRenderComplete does not have any parameters.